<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>Docs For Class DomLanguageController</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
						<script src="../media/lib/classTree.js"></script>
												<script language="javascript" type="text/javascript">
				var imgPlus = new Image();
				var imgMinus = new Image();
				imgPlus.src = "../media/images/plus.png";
				imgMinus.src = "../media/images/minus.png";
				
				function showNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgMinus.src;
					oTable.style.display = "block";
				}
				
				function hideNode(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
							var oImg = document.layers["img" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
							var oImg = document.all["img" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
							var oImg = document.getElementById("img" + Node);
									break;
							}
					oImg.src = imgPlus.src;
					oTable.style.display = "none";
				}
				
				function nodeIsVisible(Node){
							switch(navigator.family){
								case 'nn4':
									// Nav 4.x code fork...
							var oTable = document.layers["span" + Node];
									break;
								case 'ie4':
									// IE 4/5 code fork...
							var oTable = document.all["span" + Node];
									break;
								case 'gecko':
									// Standards Compliant code fork...
							var oTable = document.getElementById("span" + Node);
									break;
							}
					return (oTable && oTable.style.display == "block");
				}
				
				function toggleNodeVisibility(Node){
					if (nodeIsVisible(Node)){
						hideNode(Node);
					}else{
						showNode(Node);
					}
				}
			</script>
					</head>
		<body>
			<div class="page-body">			
<h2 class="class-name"><img src="../media/images/Class_logo.png"
														alt=" Class"
														title=" Class"
														style="vertical-align: middle"> DomLanguageController</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
											<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
						
			</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Can be used to create multilanguage website.</p>
<p class="description"><p>Loads language from conf dir with file name lang.KEY.php  File should be structured like this  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-var">$LANGUAGE&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">String&nbsp;</span><a href="http://www.php.net/key">key</a>&nbsp;=&gt;&nbsp;<span class="src-id">String&nbsp;translation</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-php">?&gt;</span></div></li>
</ol></div>  Replacements can be written as [$REPLACEMENT_NAME]. Sample: 'Hello, [$firstName]'</p><p>Usage:  <div class="src-code"><ol><li><div class="src-line">&nbsp;<span class="src-comm">//&nbsp;basic&nbsp;usage.&nbsp;initialization.</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-id"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span><span class="src-sym">::</span><a href="../DomMvc/DomLanguageController.html#methodc">c</a><span class="src-sym">(</span><span class="src-str">'default'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">-&gt;</span><a href="../DomMvc/DomLanguageController.html#methodaddLanguage">addLanguage</a><span class="src-sym">(&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Est'</span><span class="src-sym">)&nbsp;)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">-&gt;</span><a href="../DomMvc/DomLanguageController.html#methodaddLanguage">addLanguage</a><span class="src-sym">(&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Eng'</span><span class="src-sym">)&nbsp;)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-sym">-&gt;</span><a href="../DomMvc/DomLanguageController.html#methodsetDefaultLanguage">setDefaultLanguage</a><span class="src-sym">(</span><span class="src-str">'Eng'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-sym">-&gt;</span><a href="../DomMvc/DomLanguageController.html#methodinit">init</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">//&nbsp;get&nbsp;all&nbsp;usable&nbsp;languages</span></div></li>
<li><div class="src-line">&nbsp;<a href="../Dom/_libs---Dom.init.php.html#functiondebug">debug</a><span class="src-sym">(</span><span class="src-id"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span><span class="src-sym">::</span><a href="../DomMvc/DomLanguageController.html#methodc">c</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">::</span><a href="../DomMvc/DomLanguageController.html#methodgetLanguages">getLanguages</a><span class="src-sym">(</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">//&nbsp;get&nbsp;sentence&nbsp;(See&nbsp;also&nbsp;using&nbsp;through&nbsp;Smarty(DomView)&nbsp;)</span></div></li>
<li><div class="src-line">&nbsp;<a href="../Dom/_libs---Dom.init.php.html#functiondebug">debug</a><span class="src-sym">(&nbsp;</span><span class="src-id"><a href="../DomController/DomLanguage.html">DomLanguage</a></span><span class="src-sym">::</span><a href="../DomController/DomLanguage.html#methodgetl">getl</a><span class="src-sym">(</span><span class="src-str">'greeting'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'firstName'&nbsp;</span>=&gt;&nbsp;<span class="src-str">'Oliver'</span><span class="src-sym">)&nbsp;)&nbsp;)</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;greeting&nbsp;=&gt;&nbsp;'Hello,&nbsp;[$firstName]!'&nbsp;will&nbsp;be&nbsp;'Hello,&nbsp;Oliver!'</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-comm">//&nbsp;or</span></div></li>
<li><div class="src-line">&nbsp;<a href="../Dom/_libs---Dom.init.php.html#functiondebug">debug</a><span class="src-sym">(&nbsp;</span><a href="../DomBase/_libs---DomMvc---DomLanguage.class.php.html#functionlang">lang</a><span class="src-sym">(</span><span class="src-str">'greeting'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'firstName'&nbsp;</span>=&gt;&nbsp;<span class="src-str">'Oliver'</span><span class="src-sym">)&nbsp;)&nbsp;)</span><span class="src-sym">;&nbsp;</span><span class="src-comm">//&nbsp;greeting&nbsp;=&gt;&nbsp;'Hello,&nbsp;[$firstName]!'&nbsp;will&nbsp;be&nbsp;'Hello,&nbsp;Oliver!'</span></div></li>
</ol></div>  It automatically uses $_GET['lang'] variable to change current language. If $_GET['lang'] value is not found in added languages default language will be used.  Also if language is changed using $_GET['lang'] it is stored in session and afterwards that language will be used as current.</p><p>Relation to Smarty(DomView):  <ul><li>See Smarty function lang. (Usage sample: {lang key=KEY REPLACEMENT_NAME=value firstName=$userFirstName})</li><li>Also DomView adds $lang variable. (Usage sample: {$lang.KEY}). Notice that replacements cannot be used this way, but its faster.</li></ul></p></p>
		<p class="notes">
			Located in <a class="field" href="_libs---DomMvc---DomLanguage.class.php.html">/libs/DomMvc/DomLanguage.class.php</a> (line <span class="field"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a67">67</a></span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>


	<a name="sec-const-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Class Constant Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Constants</span> (<a href="#sec-consts">details</a>)
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<div class="const-summary">
								<div class="const-title">
					<img src="../media/images/Constant.png" alt=" " />
					<a href="#SESSION_VAR" title="details" class="const-name">SESSION_VAR</a> = 					<span class="var-type"> 'DomSiteCurrentLanguage'</span>

				</div>
							</div>
		</div>
	</div>


	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
							
									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																			
				<div class="method-definition">
					<img src="../media/images/StaticMethod.png" alt=" "/>
					static 						<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
										<a href="#c" title="details" class="method-name">c</a>
											([<span class="var-type">String</span>&nbsp;<span class="var-name">$sessionId</span> = <span class="var-default">'default'</span>])
									</div>
																																																											
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
										<a href="#addLanguage" title="details" class="method-name">addLanguage</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">String</span>&nbsp;<span class="var-name">$link</span> = <span class="var-default">''</span>], [<span class="var-type">String</span>&nbsp;<span class="var-name">$media</span> = <span class="var-default">''</span>])
									</div>
																							
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../DomController/DomLanguage.html">DomLanguage</a></span>
										<a href="#getCurrentLanguage" title="details" class="method-name">getCurrentLanguage</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">Array</span>
										<a href="#getLanguages" title="details" class="method-name">getLanguages</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
										<a href="#init" title="details" class="method-name">init</a>
										()
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result">void</span>
										<a href="#setCurrentLanguage" title="details" class="method-name">setCurrentLanguage</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>)
									</div>
															
				<div class="method-definition">
					<img src="../media/images/Method.png" alt=" "/>
											<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
										<a href="#setDefaultLanguage" title="details" class="method-name">setDefaultLanguage</a>
											(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>)
									</div>
											</div>
		</div>
	</div>		

	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
							
										<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>
<a name="methodc" id="c"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/StaticMethod.png" />
		<span class="method-title">static c</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a106">106</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		static <span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
		<span class="method-name">
			c
		</span>
					([<span class="var-type">String</span>&nbsp;<span class="var-name">$sessionId</span> = <span class="var-default">'default'</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$sessionId</span>			</li>
				</ul>
		
			
	</div>
<a name="methodaddLanguage" id="addLanguage"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">addLanguage</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a122">122</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Adds new language. Use link and media if you want to make easy language menu for website.</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
		<span class="method-name">
			addLanguage
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>, [<span class="var-type">String</span>&nbsp;<span class="var-name">$link</span> = <span class="var-default">''</span>], [<span class="var-type">String</span>&nbsp;<span class="var-name">$media</span> = <span class="var-default">''</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$key</span>			</li>
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$link</span>			</li>
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$media</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetCurrentLanguage" id="getCurrentLanguage"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getCurrentLanguage</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a170">170</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../DomController/DomLanguage.html">DomLanguage</a></span>
		<span class="method-name">
			getCurrentLanguage
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetLanguages" id="getLanguages"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">getLanguages</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a176">176</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Array</span>
		<span class="method-name">
			getLanguages
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodinit" id="init"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">init</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a151">151</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Initializes language controller. After languages are added use this to load current language. Do this before using any language features.</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
		<span class="method-name">
			init
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodsetCurrentLanguage" id="setCurrentLanguage"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">setCurrentLanguage</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a182">182</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			setCurrentLanguage
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$key</span>			</li>
				</ul>
		
			
	</div>
<a name="methodsetDefaultLanguage" id="setDefaultLanguage"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<img src="../media/images/Method.png" />
		<span class="method-title">setDefaultLanguage</span> (line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a139">139</a></span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Sets default language</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../DomMvc/DomLanguageController.html">DomLanguageController</a></span>
		<span class="method-name">
			setDefaultLanguage
		</span>
					(<span class="var-type">String</span>&nbsp;<span class="var-name">$key</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">String</span>
				<span class="var-name">$key</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>

	<a name="sec-consts"></a>
	<div class="info-box">
		<div class="info-box-title">Class Constants</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Constants</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="constSESSION_VAR" id="SESSION_VAR"><!-- --></A>
<div class="oddrow">

	<div class="const-header">
		<img src="../media/images/Variable.png" />
		<span class="const-title">
			<span class="const-name">SESSION_VAR</span>
			 = <span class="const-default"> 'DomSiteCurrentLanguage'</span>
			(line <span class="line-number"><a href="../__filesource/fsource_DomBase__libsDomMvcDomLanguage.class.php.html#a92">92</a></span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
	
	
</div>
						
		</div>
	</div>
	
	<p class="notes" id="credit">
		Documentation generated on Fri, 24 Sep 2010 21:14:02 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</div></body>
</html>